<template>
  <div>
    <textInterview-upload
      v-if="uploadOrEdit == 0"
      ref="textInterviewUpload"
    ></textInterview-upload>
    <textInterview-edit
      v-if="uploadOrEdit == 1"
      ref="textInterviewEdit"
    ></textInterview-edit>
  </div>
</template>

<script>
import textInterviewEdit from "./textinterview-edit.vue";
import textInterviewUpload from "./textinterview-upload.vue";
export default {
  components: { textInterviewEdit, textInterviewUpload },
  activated() {
    //先判断是上传还是修改
    let id = this.$route.params.id;
    //如果是修改,则重新渲染数据
    if (id) {
      this.uploadOrEdit = 1;
      this.examData = this.$route.params.examData;
      this.$nextTick(() => {
        this.$refs.textInterviewEdit.init(this.examData);
      });
    }
  },
  data() {
    return {
      examData: {},
      //0表示upload,1表示edit
      uploadOrEdit: 0,
    };
  },
  methods: {
    changeState() {
      this.uploadOrEdit = 0;
    },
  },
};
</script>

<style>
</style>